package com.yidu.BusinessParament.mapper;


import com.yidu.BusinessParament.entity.Broker2;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @券商 Mapper类
 * @version 1.0
 * @auther 林肯
 * @date 2022/12/8 -18:11
 */
@Mapper
public interface BrokerMapper {
    /**
     * page 页码
     * limit 每页显示的条数
     * 查询数据
     * @param map
     * @return
     */
    @Select("select * from broker where 1=1 ${sqlWhere} order by brokerId limit #{page},#{limit}")
    List<Broker2> selectBroker(Map map);

    /**
     * 分页查行数 模糊查询后的行数 根据条件
     * @param map
     * @return
     */
    @Select("select count(*) from broker where 1=1 ${sqlWhere}")
    int selectCount(Map map);

    /**
     * 添加数据
     * @param broker2 券商设置
     * @return
     */
    @Insert("insert into broker values(#{brokerId},#{brokerName},#{brokerInstructions},#{brokerDesc})")
    int insertBroker(Broker2 broker2);

    /**
     * 删除数据
     * @param brokerId 券商编号
     * @return
     */
    int deleteBroker(List<String> brokerId);

    /**
     * 修改数据
     * @param broker2 券商设置
     * @return
     */
    @Update("update broker set brokerName=#{brokerName},brokerInstructions=#{brokerInstructions},brokerDesc=#{brokerDesc} where brokerId=#{brokerId}")
    int updateBroker(Broker2 broker2);

    /**
     * 获取最大ID的方法
     * @return
     */
    @Select("select brokerId from broker order by brokerId desc limit 1")
    public String selectMaxId();
}
